home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / TextPertDK#1 / MPW C Sources & Examples.image / Example2 / AppleScan.h < prev    next >
Text File  |  1991-10-25  |  8KB  |  255 lines

  1. /*
  2.         This is the include file for the calls that are defined in the
  3.         APPLE SCANNER TECHNICAL REFERENCE MANUAL.
  4.         
  5.         The calls defined in the manual are implemented by DEVICE MANAGER CALLS,
  6.         and are the standard calls that Apple has defined for a scanner.
  7.         
  8. */
  9.  
  10. #define    _32k                        32768
  11. #define ErrMemory                -1000
  12. #define    ErrTrans                -1001
  13. #define    FinScan                    200
  14.  
  15. #define TOutFullScan         7200      /* Two Minutes */
  16. #define TOutPartScan         900            /* 15 Seconds  */
  17.  
  18.  
  19.     /* Type of Composition of the scan data returned */
  20.     
  21. #define ScLineArt            0
  22. #define ScHalfTone        1
  23. #define ScGrayScale        2
  24.     
  25.     /* Gray curve used in gray scan */
  26.     
  27. #define ScLightDetail        0
  28. #define ScNormalDetail    1
  29. #define ScDarkDetail        2
  30.     
  31.     
  32.     /* Errors returned by the calls */
  33.     
  34. #define noErr                    0    
  35. #define ScNotFountErr    -17064        /* No scanner found */
  36. #define ScComErr            -17065        /* Communication malfunction */
  37. #define ScResetErr        -17066        /* Scanner has been reseted/Initialized; send parameters again */
  38. #define ScParamErr        -17067        /* Illegal parameter(s) or command(s) */
  39. #define ScScannerErr    -17068        /* Internal scanner hardware error */
  40. #define ScResetErr2        -17069        /* Scanner reset; all parameters will have to be set again */
  41. #define ScEOS                    -17070        /* End Of Scan */
  42.     
  43. #define TFalse            0            /* Constant Equivalent a FALSE */
  44. #define TTrue                (!TFalse)            /* Constant Equivalent a TRUE */
  45.     
  46. typedef struct TagScCompRec
  47.         {
  48.         long                            Reserved;
  49.         short                            ResElements;
  50.         short                            HalfToneElements;
  51.         short                            BrightnessMax;
  52.         short                            ContrastMax;
  53.         long                            BitsPerPixel;
  54.         short                            MinReadSize;
  55.         }ScCompRec;
  56.     
  57. typedef struct TagScStdFeaturesRec
  58.         {
  59.         long                            Reserved;
  60.         short                            Version;
  61.         short                            ScanWidthNum;
  62.         short                            ScanWidthDen;
  63.         short                            ScanLengthNum;
  64.         short                            ScanLengthDen;
  65.         ScCompRec                    Composition[ScGrayScale];
  66.         }ScStdFeaturesRec, *ScStdFeaturesPtr;
  67.  
  68. typedef short                    ScResArray[1];
  69.     
  70. typedef short                    *ScResPtr;
  71.  
  72. typedef struct TagScAreaRec
  73.         {
  74.         long                    Reserved;
  75.         short                    XDpi;
  76.         short                    YDpi;
  77.         Rect                    ScanRect;
  78.         short                    Brightness;
  79.         short                    Contrast;
  80.         unsigned char    Composition;
  81.         unsigned char    BitsPerPixel;
  82.         short                    HalfTone;
  83.         }ScAreaRec, *ScAreaPtr;
  84.     
  85.     
  86. typedef struct TagScScanArea
  87.         {
  88.         long                    Reserved;
  89.         short                    NumAreas;
  90.         ScAreaRec            ScanAreas[1];
  91.         }ScScanArea, *ScScanAreaPtr;
  92.         
  93.  
  94. typedef struct TagScAdvFeaturesRec
  95.         {
  96.         long                    Reserved;
  97.         short                    Version;
  98.         short                    SecondaryMax;
  99.         long                    DownLoadFlags;
  100.         long                    RestrictFlags;
  101.         long                    ControlFlags;
  102.         }ScAdvFeaturesRec, *ScAdvFeaturesPtr;
  103.  
  104.  
  105. typedef struct TagScPatRec
  106.         {
  107.         unsigned char    XDimension;
  108.         unsigned char    YDimension;
  109.         unsigned char    PatData[1];
  110.         }ScPatRec, *ScPatPtr;
  111.  
  112. typedef unsigned char String31[32];
  113.  
  114. typedef String31 ScHalfToneArray[1];
  115.  
  116. typedef unsigned char *ScHalfTonePtr;
  117.  
  118. /***************************************************************************************/
  119. /********************************** ROUTINE HEADERS ************************************/
  120. /***************************************************************************************/
  121.     /* Opening and Closing the standard driver */
  122. /***************************************************************************************/
  123. pascal OSErr ScOpen(Str255 Nombre, short *RefNum);   /* Variation ; Also receives the name */
  124.  
  125.     /* Opens the driver and reset the scanner to it default values. */
  126.     
  127.     
  128. /***************************************************************************************/
  129. pascal OSErr ScClose(short RefNum);
  130.  
  131.     /* Closes the driver and releases the scanner. */
  132.     
  133.     
  134.     
  135.     /* Getting Standard Features */
  136. /***************************************************************************************/
  137. /*pascal OSErr ScGetStdFeatures(short RefNum,
  138.                                                             ScStdFeaturesPtr    stdFeaturesPtr,
  139.                                                             short    Length);*/
  140.     
  141.     /* Gives the user a complete description of the features of the scanner, following the 
  142.       structure described in the stdFeaturesRec returned. */
  143.  
  144.  
  145. /***************************************************************************************/
  146. pascal OSErr ScGetRes(short RefNum,
  147.                                             short            CompType,
  148.                                             ScResPtr    ResPtr);
  149.     
  150.     /* Returns an array with the resolutions supported by the scanner.
  151.       The number of Resolutions supported by the scanner is defined in the stdFeaturesRec.  */
  152.  
  153.  
  154. /***************************************************************************************/
  155. pascal OSErr ScGetHalfTones(short RefNum,
  156.                                                 short            CompType,
  157.                                                 ScHalfTonePtr    HalfTonePtr);
  158.  
  159.     /* Returns the list of supported halftone patterns.
  160.       This list has the structure described in the schalftone array. */
  161.       
  162.       
  163.  
  164.     /* Setting Scan Area */
  165. /***************************************************************************************/
  166. pascal OSErr ScSetScanArea(short RefNum,
  167.                                                    ScScanArea *ScanAreaPtr);
  168.     
  169.     /* Sets the area to scan, and also the parameters to use in the scan of that area. */
  170.     
  171.     
  172.  
  173.     /* Reading Scanned Data */
  174. /***************************************************************************************/
  175. pascal OSErr ScDoScan(short RefNum,
  176.                                           Ptr        Buffer,
  177.                                           long    *Count,
  178.                                           short    Unused,
  179.                                           short    ByteWidth,
  180.                                           short    RowBytes);
  181.     
  182.     /* Starts scan and returns data following the parameters previously set. */
  183.     
  184.     
  185. /***************************************************************************************/
  186. pascal OSErr ScAbortScan(short RefNum);
  187.  
  188.     /* Aborts the scan in progress. Is the only call that the scanner
  189.       will answer to while a scan is being done.        */
  190.  
  191.  
  192.  
  193.     /* Getting Advanced Features */
  194. /***************************************************************************************/
  195. pascal OSErr ScGetAdvFeatures(short RefNum,
  196.                           ScAdvFeaturesPtr    AdvFeaturesPtr,
  197.                           short                            Length);
  198.     
  199.     /* Gives the user avdanced features of the scanner. Returns a
  200.       handle to ScAdvFeaturesRec. If a scanner doesn't support this call,
  201.       a statuserr value of -18 is returned. */
  202.       
  203.       
  204. /***************************************************************************************/
  205. pascal OSErr ScSetHtPattern(short            RefNum,
  206.                                                         ScPatPtr    PatPtr);
  207.  
  208.     /* Sets the downloadable halftone pattern */
  209.     
  210.     
  211. /***************************************************************************************/
  212. pascal OSErr ScSetGroup3(short RefNum,
  213.                                                  Boolean    CompressOn);
  214.  
  215.     /* Enables and disables data compression in data returned by the scanner.
  216.       The compression used is Group III, 1-dimensional standard FAX encoding. */
  217.       
  218.       
  219. /***************************************************************************************/
  220. pascal OSErr ScSetNoHome(short RefNum,
  221.                                                  Boolean    NoHome);
  222.  
  223.     /* This function control whether or not the carriage assembly returns
  224.       to the home position after scanning. */
  225.       
  226.       
  227. /***************************************************************************************/
  228. pascal OSErr ScSetLamp(short RefNum,
  229.                                            Boolean    LampOn);
  230.  
  231.     /* This call turns the fluorescent lamp On and Off. */
  232.     
  233.     
  234. /***************************************************************************************/
  235. pascal OSErr ScSetGrayMap(short RefNum,
  236.                                               short    GrayMap);
  237.  
  238.     /* Sets the gray map curve used while scanning. */
  239.     
  240.     
  241. /***************************************************************************************/
  242. pascal OSErr ScSetThresHold(short RefNum,
  243.                                                         short    Threshold);
  244.  
  245.     /* Sets the AutoBackground threshold level. */
  246.     
  247.     
  248. /***************************************************************************************/
  249. pascal OSErr ScSetWaitButton(short RefNum,
  250.                                                          Boolean    WaitButton);
  251.  
  252.     /* This function controls if the scan will begin after a
  253.       DoScan command is sent or after the scanner's scan
  254.       button has been pressed. */        
  255.